﻿#ifndef SERVICEMANAGER_H
#define SERVICEMANAGER_H

#include "DriverStruct.h"
#include "C0C_Def.h"


bool PreInstallService(const InfFileInstall *pInfFileInstallList = infFileInstallList);

bool UninstallService(
    const InfFileInstall *pInfFileInstallList = infFileInstallList,
    const InfFile::InfFileUninstall *pInfFileUninstallList = infFileUninstallList);

bool InstallDriver(
    const QString& infFilePath,
    const QString& paramsA = "PortName=COM#",
    const QString& paramsB = "PortName=COM#",
    int num = -1
    );

bool UninstallDriver(int num);

/******************** Device Tool ********************/

bool RemoveDevice(HDEVINFO hDevInfo,
                  PSP_DEVINFO_DATA pDevInfoData,
                  ConstDevicePropertiesPtr pDevProperties,
                  bool *pRebootRequired);

bool RemoveDevices(DeviceEnumFilter pFilter,
                   ConstDevicePropertiesPtr pDevProperties,
                   bool *pRebootRequired);

bool EnableDevices(DeviceEnumFilter pFilter,
                   ConstDevicePropertiesPtr pDevProperties,
                   bool *pRebootRequired);

int DisableDevice(HDEVINFO hDevInfo,
                  PSP_DEVINFO_DATA pDevInfoData,
                  ConstDevicePropertiesPtr pDevProperties,
                  bool *pRebootRequired,
                  SimpleStack *pDevPropertiesStack);

bool DisableDevices(DeviceEnumFilter pFilter,
                    ConstDevicePropertiesPtr pDevProperties,
                    bool *pRebootRequired,
                    SimpleStack *pDevPropertiesStack);

int UpdateDriver(const QString &pInfFilePath,
                 const QString &pHardwareId,
                 DWORD flags,
                 bool mandatory,
                 bool *pRebootRequired);

bool InstallBusDevice(const QString &pInfFilePath,
                      const QString &pDevId,
                      const QString &pDevInstID,
                      DeviceCallback pDevCallBack,
                      void *pDevCallBackParam,
                      bool updateDriver,
                      bool *pRebootRequired);

void PromptReboot();

#endif // SERVICEMANAGER_H
